return g_object_new (GDK_TYPE_BROADWAY_DEVICE,
"name", "Core Pointer",
"type", GDK_DEVICE_TYPE_MASTER,
- "input-source", GDK_SOURCE_MOUSE,
- "input-mode", GDK_MODE_SCREEN,
+ "source", GDK_SOURCE_MOUSE,
"has-cursor", TRUE,
"display", display,
NULL);
return g_object_new (GDK_TYPE_BROADWAY_DEVICE,
"name", "Core Keyboard",
"type", GDK_DEVICE_TYPE_MASTER,
- "input-source", GDK_SOURCE_KEYBOARD,
- "input-mode", GDK_MODE_SCREEN,
+ "source", GDK_SOURCE_KEYBOARD,
"has-cursor", FALSE,
"display", display,
NULL);
return g_object_new (GDK_TYPE_BROADWAY_DEVICE,
"name", "Touchscreen",
"type", GDK_DEVICE_TYPE_SLAVE,
- "input-source", GDK_SOURCE_TOUCHSCREEN,
- "input-mode", GDK_MODE_SCREEN,
+ "source", GDK_SOURCE_TOUCHSCREEN,
"has-cursor", FALSE,
"display", display,
NULL);
PROP_ASSOCIATED_DEVICE,
PROP_TYPE,
PROP_SOURCE,
- PROP_MODE,
PROP_HAS_CURSOR,
PROP_N_AXES,
PROP_VENDOR_ID,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS | G_PARAM_EXPLICIT_NOTIFY);
- /*
- * GdkDevice:mode:
- *
- * Input mode for the device.
- */
- device_props[PROP_MODE] =
- g_param_spec_enum ("mode",
- P_("Input mode for the device"),
- P_("Input mode for the device"),
- GDK_TYPE_INPUT_MODE,
- GDK_MODE_DISABLED,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_EXPLICIT_NOTIFY);
-
/**
* GdkDevice:has-cursor:
*
case PROP_SOURCE:
device->source = g_value_get_enum (value);
break;
- case PROP_MODE:
- gdk_device_set_mode (device, g_value_get_enum (value));
- break;
case PROP_HAS_CURSOR:
device->has_cursor = g_value_get_boolean (value);
break;
case PROP_SOURCE:
g_value_set_enum (value, device->source);
break;
- case PROP_MODE:
- g_value_set_enum (value, device->mode);
- break;
case PROP_HAS_CURSOR:
g_value_set_boolean (value, device->has_cursor);
break;
return device->source;
}
-/**
- * gdk_device_get_mode:
- * @device: a #GdkDevice
- *
- * Determines the mode of the device.
- *
- * Returns: a #GdkInputMode
- **/
-GdkInputMode
-gdk_device_get_mode (GdkDevice *device)
-{
- g_return_val_if_fail (GDK_IS_DEVICE (device), 0);
-
- return device->mode;
-}
-
-/**
- * gdk_device_set_mode:
- * @device: a #GdkDevice.
- * @mode: the input mode.
- *
- * Sets a the mode of an input device. The mode controls if the
- * device is active and whether the device’s range is mapped to the
- * entire screen or to a single surface.
- *
- * Note: This is only meaningful for floating devices, master devices (and
- * slaves connected to these) drive the pointer cursor, which is not limited
- * by the input mode.
- *
- * Returns: %TRUE if the mode was successfully changed.
- **/
-gboolean
-gdk_device_set_mode (GdkDevice *device,
- GdkInputMode mode)
-{
- g_return_val_if_fail (GDK_IS_DEVICE (device), FALSE);
-
- if (device->mode == mode)
- return TRUE;
-
- if (mode == GDK_MODE_DISABLED &&
- gdk_device_get_device_type (device) == GDK_DEVICE_TYPE_MASTER)
- return FALSE;
-
- device->mode = mode;
- g_object_notify_by_pspec (G_OBJECT (device), device_props[PROP_MODE]);
-
- return TRUE;
-}
-
/**
* gdk_device_get_n_keys:
* @device: a #GdkDevice
GdkAxisInfo *info;
g_return_val_if_fail (GDK_IS_DEVICE (device), GDK_AXIS_IGNORE);
- g_return_val_if_fail (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD, GDK_AXIS_IGNORE);
+ g_return_val_if_fail (device->source != GDK_SOURCE_KEYBOARD, GDK_AXIS_IGNORE);
g_return_val_if_fail (index_ < device->axes->len, GDK_AXIS_IGNORE);
info = &g_array_index (device->axes, GdkAxisInfo, index_);
GdkAxisInfo *info;
g_return_if_fail (GDK_IS_DEVICE (device));
- g_return_if_fail (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD);
+ g_return_if_fail (device->source != GDK_SOURCE_KEYBOARD);
g_return_if_fail (index_ < device->axes->len);
info = &g_array_index (device->axes, GdkAxisInfo, index_);
gdk_device_get_n_axes (GdkDevice *device)
{
g_return_val_if_fail (GDK_IS_DEVICE (device), 0);
- g_return_val_if_fail (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD, 0);
+ g_return_val_if_fail (device->source != GDK_SOURCE_KEYBOARD, 0);
return device->axes->len;
}
gint i;
g_return_val_if_fail (GDK_IS_DEVICE (device), NULL);
- g_return_val_if_fail (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD, NULL);
+ g_return_val_if_fail (device->source != GDK_SOURCE_KEYBOARD, NULL);
if (device->axes->len == 0)
return NULL;
gint i;
g_return_val_if_fail (GDK_IS_DEVICE (device), FALSE);
- g_return_val_if_fail (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD, FALSE);
+ g_return_val_if_fail (device->source != GDK_SOURCE_KEYBOARD, FALSE);
if (axes == NULL)
return FALSE;
gint i;
g_return_val_if_fail (GDK_IS_DEVICE (device), FALSE);
- g_return_val_if_fail (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD, FALSE);
+ g_return_val_if_fail (device->source != GDK_SOURCE_KEYBOARD, FALSE);
if (axes == NULL)
return FALSE;
GdkAxisInfo axis_info;
gdouble axis_width, scale, offset;
- if (device->mode != GDK_MODE_SCREEN)
- return FALSE;
-
if (index_ >= device->axes->len)
return FALSE;
GdkPointerSurfaceInfo *info;
g_return_val_if_fail (GDK_IS_DEVICE (device), NULL);
- g_return_val_if_fail (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD, NULL);
+ g_return_val_if_fail (device->source != GDK_SOURCE_KEYBOARD, NULL);
display = gdk_device_get_display (device);
info = _gdk_display_get_pointer_info (display, device);
GDK_SOURCE_TABLET_PAD
} GdkInputSource;
-/**
- * GdkInputMode:
- * @GDK_MODE_DISABLED: the device is disabled and will not report any events.
- * @GDK_MODE_SCREEN: the device is enabled. The device’s coordinate space
- * maps to the entire screen.
- * @GDK_MODE_SURFACE: the device is enabled. The device’s coordinate space
- * is mapped to a single surface. The manner in which this surface
- * is chosen is undefined, but it will typically be the same
- * way in which the focus surface for key events is determined.
- *
- * An enumeration that describes the mode of an input device.
- */
-typedef enum
-{
- GDK_MODE_DISABLED,
- GDK_MODE_SCREEN,
- GDK_MODE_SURFACE
-} GdkInputMode;
-
/**
* GdkDeviceType:
* @GDK_DEVICE_TYPE_MASTER: Device is a master (or virtual) device. There will
/* Functions to configure a device */
GDK_AVAILABLE_IN_ALL
-GdkInputSource gdk_device_get_source (GdkDevice *device);
-
-GDK_AVAILABLE_IN_ALL
-GdkInputMode gdk_device_get_mode (GdkDevice *device);
-GDK_AVAILABLE_IN_ALL
-gboolean gdk_device_set_mode (GdkDevice *device,
- GdkInputMode mode);
+GdkInputSource gdk_device_get_source (GdkDevice *device);
GDK_AVAILABLE_IN_ALL
gint gdk_device_get_n_keys (GdkDevice *device);
gchar *name;
GdkInputSource source;
- GdkInputMode mode;
gboolean has_cursor;
gint num_keys;
GdkAxisFlags axis_flags;
_gdk_display_device_grab_update (display, device, source_device, serial);
- if (gdk_device_get_mode (device) == GDK_MODE_DISABLED ||
- !_gdk_display_check_grab_ownership (display, device, serial))
+ if (!_gdk_display_check_grab_ownership (display, device, serial))
{
- /* Device events are blocked by another
- * device grab, or the device is disabled
- */
+ /* Device events are blocked by another device grab */
unlink_event = TRUE;
goto out;
}
master = g_object_new (GDK_TYPE_WAYLAND_DEVICE,
"name", master_name,
"type", GDK_DEVICE_TYPE_MASTER,
- "input-source", GDK_SOURCE_MOUSE,
- "input-mode", GDK_MODE_SCREEN,
+ "source", GDK_SOURCE_MOUSE,
"has-cursor", TRUE,
"display", display,
"seat", seat,
stylus_device = g_object_new (GDK_TYPE_WAYLAND_DEVICE,
"name", tablet->name,
"type", GDK_DEVICE_TYPE_SLAVE,
- "input-source", GDK_SOURCE_PEN,
- "input-mode", GDK_MODE_SCREEN,
+ "source", GDK_SOURCE_PEN,
"has-cursor", FALSE,
"display", display,
"seat", seat,
eraser_device = g_object_new (GDK_TYPE_WAYLAND_DEVICE,
"name", eraser_name,
"type", GDK_DEVICE_TYPE_SLAVE,
- "input-source", GDK_SOURCE_ERASER,
- "input-mode", GDK_MODE_SCREEN,
+ "source", GDK_SOURCE_ERASER,
"has-cursor", FALSE,
"display", display,
"seat", seat,
seat->pointer = g_object_new (GDK_TYPE_WAYLAND_DEVICE,
"name", "Wayland Pointer",
"type", GDK_DEVICE_TYPE_SLAVE,
- "input-source", GDK_SOURCE_MOUSE,
- "input-mode", GDK_MODE_SCREEN,
+ "source", GDK_SOURCE_MOUSE,
"has-cursor", TRUE,
"display", seat->display,
"seat", seat,
seat->keyboard = g_object_new (GDK_TYPE_WAYLAND_DEVICE,
"name", "Wayland Keyboard",
"type", GDK_DEVICE_TYPE_SLAVE,
- "input-source", GDK_SOURCE_KEYBOARD,
- "input-mode", GDK_MODE_SCREEN,
+ "source", GDK_SOURCE_KEYBOARD,
"has-cursor", FALSE,
"display", seat->display,
"seat", seat,
seat->touch_master = g_object_new (GDK_TYPE_WAYLAND_DEVICE,
"name", "Wayland Touch Master Pointer",
"type", GDK_DEVICE_TYPE_MASTER,
- "input-source", GDK_SOURCE_MOUSE,
- "input-mode", GDK_MODE_SCREEN,
+ "source", GDK_SOURCE_MOUSE,
"has-cursor", TRUE,
"display", seat->display,
"seat", seat,
seat->touch = g_object_new (GDK_TYPE_WAYLAND_DEVICE,
"name", "Wayland Touch",
"type", GDK_DEVICE_TYPE_SLAVE,
- "input-source", GDK_SOURCE_TOUCHSCREEN,
- "input-mode", GDK_MODE_SCREEN,
+ "source", GDK_SOURCE_TOUCHSCREEN,
"has-cursor", FALSE,
"display", seat->display,
"seat", seat,
seat->wheel_scrolling = g_object_new (GDK_TYPE_WAYLAND_DEVICE,
"name", "Wayland Wheel Scrolling",
"type", GDK_DEVICE_TYPE_SLAVE,
- "input-source", GDK_SOURCE_MOUSE,
- "input-mode", GDK_MODE_SCREEN,
+ "source", GDK_SOURCE_MOUSE,
"has-cursor", TRUE,
"display", seat->display,
"seat", seat,
seat->finger_scrolling = g_object_new (GDK_TYPE_WAYLAND_DEVICE,
"name", "Wayland Finger Scrolling",
"type", GDK_DEVICE_TYPE_SLAVE,
- "input-source", GDK_SOURCE_TOUCHPAD,
- "input-mode", GDK_MODE_SCREEN,
+ "source", GDK_SOURCE_TOUCHPAD,
"has-cursor", TRUE,
"display", seat->display,
"seat", seat,
seat->continuous_scrolling = g_object_new (GDK_TYPE_WAYLAND_DEVICE,
"name", "Wayland Continuous Scrolling",
"type", GDK_DEVICE_TYPE_SLAVE,
- "input-source", GDK_SOURCE_TRACKPOINT,
- "input-mode", GDK_MODE_SCREEN,
+ "source", GDK_SOURCE_TRACKPOINT,
"has-cursor", TRUE,
"display", seat->display,
"seat", seat,
g_object_new (GDK_TYPE_WAYLAND_DEVICE_PAD,
"name", "Pad device",
"type", GDK_DEVICE_TYPE_SLAVE,
- "input-source", GDK_SOURCE_TABLET_PAD,
- "input-mode", GDK_MODE_SCREEN,
+ "source", GDK_SOURCE_TABLET_PAD,
"display", gdk_seat_get_display (pad->seat),
"seat", pad->seat,
NULL);
seat->master_pointer = g_object_new (GDK_TYPE_WAYLAND_DEVICE,
"name", "Core Pointer",
"type", GDK_DEVICE_TYPE_MASTER,
- "input-source", GDK_SOURCE_MOUSE,
- "input-mode", GDK_MODE_SCREEN,
+ "source", GDK_SOURCE_MOUSE,
"has-cursor", TRUE,
"display", seat->display,
"seat", seat,
seat->master_keyboard = g_object_new (GDK_TYPE_WAYLAND_DEVICE,
"name", "Core Keyboard",
"type", GDK_DEVICE_TYPE_MASTER,
- "input-source", GDK_SOURCE_KEYBOARD,
- "input-mode", GDK_MODE_SCREEN,
+ "source", GDK_SOURCE_KEYBOARD,
"has-cursor", FALSE,
"display", seat->display,
"seat", seat,
{
case GDK_AXIS_X:
case GDK_AXIS_Y:
- if (gdk_device_get_mode (device) == GDK_MODE_SURFACE)
- _gdk_device_translate_surface_coord (device, window, i,
- device_wintab->last_axis_data[i],
- &axes[i]);
- else
{
HMONITOR hmonitor;
MONITORINFO minfo = {sizeof (MONITORINFO),};
return g_object_new (g_type,
"name", name,
"type", type,
- "input-source", GDK_SOURCE_MOUSE,
- "input-mode", GDK_MODE_SCREEN,
+ "source", GDK_SOURCE_MOUSE,
"has-cursor", type == GDK_DEVICE_TYPE_MASTER,
"display", _gdk_display,
NULL);
return g_object_new (g_type,
"name", name,
"type", type,
- "input-source", GDK_SOURCE_KEYBOARD,
- "input-mode", GDK_MODE_SCREEN,
+ "source", GDK_SOURCE_KEYBOARD,
"has-cursor", FALSE,
"display", _gdk_display,
NULL);
device = g_object_new (GDK_TYPE_DEVICE_WINTAB,
"name", device_name,
"type", GDK_DEVICE_TYPE_FLOATING,
- "input-source", GDK_SOURCE_PEN,
- "input-mode", GDK_MODE_SCREEN,
+ "source", GDK_SOURCE_PEN,
"has-cursor", lc.lcOptions & CXO_SYSTEM,
"display", display,
NULL);
device_manager->dev_entered_proximity -= 1;
if (source_device != NULL &&
- source_device->sends_core &&
- gdk_device_get_mode (GDK_DEVICE (source_device)) != GDK_MODE_DISABLED)
+ source_device->sends_core)
{
_gdk_device_virtual_set_active (device_manager->core_pointer,
GDK_DEVICE (source_device));
}
else if (source_device != NULL &&
source_device->sends_core &&
- gdk_device_get_mode (GDK_DEVICE (source_device)) != GDK_MODE_DISABLED &&
_gdk_input_ignore_core == 0)
{
/* A fallback for cases when two devices (disabled and enabled)
_gdk_input_ignore_core += 1;
}
- if (source_device == NULL ||
- gdk_device_get_mode (GDK_DEVICE (source_device)) == GDK_MODE_DISABLED)
+ if (source_device == NULL)
return NULL;
/* Don't produce any button or motion events while a window is being
packet.pkCursor)) == NULL)
return NULL;
- if (source_device->sends_core &&
- gdk_device_get_mode (GDK_DEVICE (source_device)) != GDK_MODE_DISABLED)
+ if (source_device->sends_core)
{
_gdk_device_virtual_set_active (device_manager->core_pointer,
GDK_DEVICE (source_device));
case GDK_AXIS_X:
case GDK_AXIS_Y:
case GDK_AXIS_IGNORE:
- if (gdk_device_get_mode (device) == GDK_MODE_SURFACE)
- _gdk_device_translate_surface_coord (device, surface, j, value, &axes[j]);
- else
{
gint root_x, root_y;
GdkInputSource touch_source;
GdkDeviceType type;
GdkDevice *device;
- GdkInputMode mode;
gint num_touches = 0;
gchar *vendor_id = NULL, *product_id = NULL;
case XIMasterKeyboard:
case XIMasterPointer:
type = GDK_DEVICE_TYPE_MASTER;
- mode = GDK_MODE_SCREEN;
break;
case XISlaveKeyboard:
case XISlavePointer:
type = GDK_DEVICE_TYPE_SLAVE;
- mode = GDK_MODE_DISABLED;
break;
case XIFloatingSlave:
default:
type = GDK_DEVICE_TYPE_FLOATING;
- mode = GDK_MODE_DISABLED;
break;
}
({
const gchar *type_names[] = { "master", "slave", "floating" };
const gchar *source_names[] = { "mouse", "pen", "eraser", "cursor", "keyboard", "direct touch", "indirect touch", "trackpoint", "pad" };
- const gchar *mode_names[] = { "disabled", "screen", "window" };
- g_message ("input device:\n\tname: %s\n\ttype: %s\n\tsource: %s\n\tmode: %s\n\thas cursor: %d\n\ttouches: %d",
+ g_message ("input device:\n\tname: %s\n\ttype: %s\n\tsource: %s\n\thas cursor: %d\n\ttouches: %d",
dev->name,
type_names[type],
source_names[input_source],
- mode_names[mode],
dev->use == XIMasterPointer,
num_touches);
}));
device = g_object_new (GDK_TYPE_X11_DEVICE_XI2,
"name", dev->name,
"type", type,
- "input-source", input_source,
- "input-mode", mode,
+ "source", input_source,
"has-cursor", (dev->use == XIMasterPointer),
"display", display,
"device-id", dev->deviceid,
{
case GDK_AXIS_X:
case GDK_AXIS_Y:
- if (gdk_device_get_mode (device) == GDK_MODE_SURFACE)
- _gdk_device_translate_surface_coord (device, surface, i, val, &axes[i]);
- else
{
if (use == GDK_AXIS_X)
axes[i] = x;
surface,
&xev->valuators);
- if (gdk_device_get_mode (device) == GDK_MODE_SURFACE)
- {
- /* Update event coordinates from axes */
- gdk_device_get_axis (device, axes, GDK_AXIS_X, &x);
- gdk_device_get_axis (device, axes, GDK_AXIS_Y, &y);
- }
- else
- {
- x = (double) xev->event_x / scale;
- y = (double) xev->event_y / scale;
- }
+ x = (double) xev->event_x / scale;
+ y = (double) xev->event_y / scale;
event = gdk_event_button_new (ev->evtype == XI_ButtonPress
? GDK_BUTTON_PRESS
surface,
&xev->valuators);
- if (gdk_device_get_mode (device) == GDK_MODE_SURFACE)
- {
- /* Update event coordinates from axes */
- gdk_device_get_axis (device, axes, GDK_AXIS_X, &x);
- gdk_device_get_axis (device, axes, GDK_AXIS_Y, &y);
- }
- else
- {
- x = (double) xev->event_x / scale;
- y = (double) xev->event_y / scale;
- }
+ x = (double) xev->event_x / scale;
+ y = (double) xev->event_y / scale;
event = gdk_event_motion_new (surface,
device,
surface,
&xev->valuators);
- if (gdk_device_get_mode (device) == GDK_MODE_SURFACE)
- {
- /* Update event coordinates from axes */
- gdk_device_get_axis (device, axes, GDK_AXIS_X, &x);
- gdk_device_get_axis (device, axes, GDK_AXIS_Y, &y);
- }
- else
- {
- x = (double) xev->event_x / scale;
- y = (double) xev->event_y / scale;
- }
+ x = (double) xev->event_x / scale;
+ y = (double) xev->event_y / scale;
+
event = gdk_event_touch_new (ev->evtype == XI_TouchBegin
? GDK_TOUCH_BEGIN
: GDK_TOUCH_END,
surface,
&xev->valuators);
- if (gdk_device_get_mode (device) == GDK_MODE_SURFACE)
- {
- /* Update event coordinates from axes */
- gdk_device_get_axis (device, axes, GDK_AXIS_X, &x);
- gdk_device_get_axis (device, axes, GDK_AXIS_Y, &y);
- }
- else
- {
- x = (double) xev->event_x / scale;
- y = (double) xev->event_y / scale;
- }
+ x = (double) xev->event_x / scale;
+ y = (double) xev->event_y / scale;
event = gdk_event_touch_new (GDK_TOUCH_UPDATE,
GUINT_TO_POINTER (xev->detail),